package com.simon.app.october.common.utils;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 用于获取请求参数里面分页参数
 * */
public class QueryPage extends LinkedHashMap<String, Object> {
    private int page;
    private int limit;
    public QueryPage(Map<String, Object> params) {
        this.putAll(params);

        this.page = Integer.parseInt(params.get("page").toString());
        this.limit = Integer.parseInt(params.get("limit").toString());
        this.put("offset", (page-1)*limit);
        this.put("page", page);
        this.put("limit", limit);
    }

    public int getPage() {
        return page;
    }

    public int getLimit() {
        return limit;
    }
}
